<?php
App::uses('RssVer1ConverterComponent', 'Controller/Component');
App::uses('RssVer2ConverterComponent', 'Controller/Component');

class ArticlesFactory extends AppModel{

	public $useTable = false; //This model does not use a database table

	public function create($rss)
	{
		$converter = $this->createConverter($rss);
		$articles = $converter->toArticles($rss);
		return $articles;
	}

	private function createConverter($rss)
	{
		if(array_key_exists('RDF', $rss)){
			return new RssVer1ConverterComponent();
		}else if(array_key_exists('rss', $rss)){
			return new RssVer2ConverterComponent();
		}else{
		}	
	}

}

?>
